package com.sbtr.business.system.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.sbtr.business.system.entity.DictionaryParam;
import com.sbtr.business.system.dto.DictionaryParamDto;

import com.sbtr.business.system.service.DictionaryParamService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sbtr.business.system.mapper.DictionaryParamMapper;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.AbstractWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sbtr.common.PageDto;
import com.sbtr.util.PageDtoUtils;
import org.springframework.transaction.annotation.Transactional;

/**
 * 具体选项字段列表 Service接口实现类
 *
 * @author dgl
 * @since  2023-03-22
 */
@Transactional
@Service
public class DictionaryParamServiceImpl extends ServiceImpl<DictionaryParamMapper,DictionaryParam> implements DictionaryParamService {

    @Autowired
    DictionaryParamMapper dictionaryParamMapper;

    @Override
    public PageDto<DictionaryParam> pageList(DictionaryParamDto dictionaryParamDto) {

        IPage<DictionaryParam> page = new Page<>();
        page.setSize(dictionaryParamDto.getPageSize());
        page.setCurrent(dictionaryParamDto.getPage());
        page = dictionaryParamMapper.selectPages(page, BeanUtil.beanToMap(dictionaryParamDto));
        PageDto<DictionaryParam> r = PageDtoUtils.getPageDtoByIPage(page, DictionaryParam.class);

        return r;
    }
}

